<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta content="text/html; charset=UTF-8" http-equiv="content-type" />
<title> <?php echo $_REQUEST['title'] ? $_REQUEST['title'] : $data['tagname']?> - <?=SITE_NAME?>品牌 </title>
<meta name="Keywords" content="<?php echo $data['tagname']?>,LooPo,乐铺,创意礼品,创意礼物,创意生日礼物,创意杂货,创意家居,创意玩具,创意T恤" />
<meta name="Description" content="<?=SITE_NAME?>-最具创意的礼品店，主营创意礼物、创意生日礼物、创意杂货、创意家居、创意玩具、创意T恤等各种国内外创意品牌产品。正品保证，7天无条件退换保证。乐铺，用心经营，真诚对待每一位顾客。" />
<link rel="alternate" type="application/rss+xml" title="<?php echo $data['tagname']?> in LooPo" href="<?php echo $_servername?>/tag/<?php echo urlencode($data['tagname'])?>/xml/" />
<?php include VIEWS.'header.html'?>
<style type="text/css">
.tags { padding: 2px; margin: 1px; line-height:1.1em }
a.tags:link, a.tags:visited { text-decoration: none }
.tagall { line-height:220% }
.tagall {word-break:keep-all}
</style>
</head>

<body>
<?php include VIEWS.'topbar.html'?>

<div id="content">

<?php $left_scroll=true; include VIEWS.'leftnav.html'?>

<div id="right">

<?php include VIEWS.'sidesearch.html'?>
<h1><?php
if ($data['tagname']) {
    //个性化标题
    if ($_REQUEST['title'])
        echo trim($_REQUEST['title']);
    else
        echo ($_REQUEST['xml']<=1 ? '乐铺品牌：' : '') . $data['tagname'];

    echo count($list) ? ' &nbsp; <a title="使用RSS订阅本页更新" tabindex="100" href="/tag/'.urlencode($data['tagname']).'/xml/"><img width="30" height="14" src="/images/rss.gif" alt="RSS Feed" /></a> <a title="使用RSS邮天下订阅本页更新" href="http://www.emailrss.cn/?rss='. $_servername .'/tag/'.urlencode(urlencode($data['tagname'])).'/xml/" target="_blank"><img width="42" height="13" src="/images/rssmail.gif" alt="RSS邮天下" /></a>' : '';
} else {
    echo '乐铺所有标签列表';
}
?></h1>

<?php if (count($list)==0):?>

<div class="errbox roundNormal">&nbsp;&nbsp;&nbsp;本品牌下目前没有任何物品，为何不看看我们有哪些 <a href="/whatnew" class="white">新品上架</a> 呢？</div>

<?php else:?>

<?php if($data['tagname']):?>

<?php include VIEWS.'shopcarinfo.html'?>

   <?php
    //tag描述
    if($data['tagdesc']):?>
    <div id="catdesc"><?php echo $data['tagdesc']?></div>
    <?php endif?>
    <br clear="all" />

    <form action="">
    <div style="float:left">
    <font class="px12" style="color:#666">&nbsp;排序方式</font>
    <select name="o" class="px12" style="color:#666" onchange="javascript:submit()">
    <option value="4"<?php if($_GET['o']==4) echo ' selected="selected"'?>>喜爱程度</option>
    <option value="1"<?php if($_GET['o']==1) echo ' selected="selected"'?>>物品名称</option>
    <option value="2"<?php if($_GET['o']==2) echo ' selected="selected"'?>>价格</option>
    <option value="3"<?php if(!$_GET['o'] || $_GET['o']==3) echo ' selected="selected"'?>>更新日期</option>
    </select>
    <input type="hidden" name="p" value="<?php echo (int)$_GET['p']?>" />
    </div>
    </form>
    <br /><br clear="all" />

    <div class="itemlist">
    <?php
    $list['list'] =& $list;
    //每行显示的物品数
    $cols = 5;
    //不满一行的用空白填充
    $_needfill = ($cols - count($list['list']) % $cols);
    if ($_needfill != $cols) for ($_n=0; $_n<$_needfill; $_n++) $list['list'][] = null;
    ?>

    <table cellpadding="0" cellspacing="0" align="center" id="itemlist_table" border="0">
        <?php
        foreach ($list['list'] as $v):
        do_action('view_itemslist_item', array('item'=>&$v));
        //$v['price1'] = preg_replace('/^(\d+)\.(\d+)$/', '$1.<font size="-2">$2</font>', $v['price1']);
        $v['price'] = ($v['stocknum'] > 0 ? "<font class=\"price_small\">". (floatval($v['price2'])>floatval($v['price1']) ? "特价 " : '') ."&yen; {$v['price1']}</font>" : "<a href=\"/alertme/{$v['id']}\" onclick=\"javascript:alertme({$v['id']});return false\"><div class='sprites btn_alertme_s'><span>到货通知我</span></div></a>");
        if($item_i%$cols==0):
        ?><tr><?php endif?>

        <td width="20%" align="center" height="240">
            <?php if($v['model']):?>

                <div class="items" id="item<?php echo $v['id']?>"><a href="/<?php echo $v['id']?>/<?php echo $pid?>" style="background:transparent"><img vspace="5" src="/images/items/thumb/120/<?php echo $v['model']?>.png" width="120" height="120" alt="<?php echo htmlspecialchars($v['name'])?>" class="<?php echo ($v['stocknum'] == 0 ? 'dark' : 'hand')?>" /></a></div><br clear="all" />
                <div class="items_name"><a class="px12" tabindex="2" href="/<?php echo $v['id']?>/<?php echo $pid?>" onmousedown="return cl(this,'<?php echo $v['id']?>','items:click','<?php echo $v['sig_click']?>')"><?php echo htmlspecialchars(trim($v['name']))?></a></div>
                <div class="items_price"><b><?php echo $v['price']?></b></div>
                <br />
                <?php if($v['stocknum'] > 0):?><script type="text/javascript">new Draggable('item<?php echo $v['id']?>',{revert:true,onDrag:function(element){__dg(element)},onEnd:function(element){__de(element)}})</script><?php endif?>
            <?php endif?>
        </td>
        <?php if($item_i%$cols!=($cols-1)):?><td bgcolor="#<?php echo $v['name'] ? 'F3F3F3' : 'FFFFFF' ?>"><img src="/images/blank.gif" width="1" height="1" alt="" /></td><?php endif?>

    <?php $item_i++;?>
    <?php if($item_i%$cols==0):?></tr><?php endif?>
    <?php endforeach;?>
    </table>
</div>

    <br clear="all" />

    <img src="/images/icon_arrow_right.gif" alt="arrow right" /><a tabindex="2" href="/tag">查看更多标签……</a>

<?php else:
$tmp = $list;
function s($a,$b) {
    if ($a==$b) return 0;
    return $a['ct']>$b['ct']?-1:1;
}
usort($tmp, "s");
//最大的tag数
$mn = $tmp[0]['ct'];
unset($tmp);

//tag数量,最大数量,最小文字,最大文字
function fz($me, $maxnum=10, $min=12, $max=36) {
    $m = ($max-$min)/log($maxnum);
    $v = floor(log($me)*$m+$min);
    return $v;
}
?>

    <span class="tagall">
    <?php foreach ($list as $v):?>
    <a tabindex="1" href="/tag/<?php echo urlencode($v['name'])?>/" style="font-size:<?php echo fz($v['ct'], $mn)?>px" class="tags" title="<?php echo $v['ct']?> 件物品"><?php echo $v['name']?></a>
    <?php endforeach?>
    </span>
    <div style="text-align:right;"><?php if($list['page']['next']):?><a tabindex="2" href=<?php echo $list['page']['url']?>p=<?php echo $list['page']['next']?>>更多的标签&gt;</a>&nbsp;&nbsp;<?php endif?></div>

<?php endif?>

<?php endif;?>

    </div>
</div>

<?php include VIEWS.'copyright.html'?>

</body>
</html>
